123 #include "StPeCMaker.h"
124 #include "StPeCEnumerations.h"
125 #include "StEventTypes.h"
127 #include "StMessMgr.h"
131 #ifndef ST_NO_NAMESPACES
135 #include "StTriggerDetectorCollection.h"
136 #include "StCtbTriggerDetector.h"
137 #include "StMwcTriggerDetector.h"
138 #include "StVpdTriggerDetector.h"
139 #include "StZdcTriggerDetector.h"
140 #include "StFtpcHitCollection.h"
141 #include "StFtpcPlaneHitCollection.h"
142 #include "StFtpcSectorHitCollection.h"
144 #include "StMcEventTypes.hh"
145 #include "StMcEventMaker/StMcEventMaker.h"
146 #include "StIOMaker/StIOMaker.h"
152 static const char rcsid[] =
"$Id: StPeCMaker.cxx,v 1.36 2018/02/26 23:30:18 smirnovd Exp $";
158 treeFileName =
"StPeCMaker.tree.root" ;
159 triggerChoice =
"something";
164 StPeCMaker::~StPeCMaker()
170 Int_t StPeCMaker::Init() {
172 LOG_INFO <<
"StPeCMake INIT: tree output file: " << treeFileName << endm;
174 LOG_INFO <<
"StPeCMake INIT: infoLevel: " << infoLevel << endm;
175 LOG_INFO <<
"StPeCMaker INIT: readStMuDst " << readStMuDst << endm;
176 LOG_INFO <<
"StPeCMaker INIT: readStEvent " << readStEvent << endm;
177 LOG_INFO <<
"StPeCMaker INIT: readBoth " << readStMuDst_and_StEvent << endm;
178 LOG_INFO <<
"trigger to be selected: " << triggerChoice << endm;
179 LOG_INFO <<
"choice for output: " << treeOff << endm;
182 m_outfile =
new TFile(treeFileName,
"recreate");
183 m_outfile->SetCompressionLevel(1);
186 if(!treeOff)uDstTree =
new TTree(
"uDst",
"Pcol uDst", 99);
190 pevent =
new StPeCEvent(useBemc, useTOF, useVertex, useTracks, useRP, readStMuDst, readStEvent, readStMuDst_and_StEvent);
191 pevent->setInfoLevel(infoLevel);
192 if(!pevent) LOG_INFO <<
"StPeCMaker Init: unable to make instance of StPeCEvent ---------- " << endm;
194 trigger->setInfoLevel(infoLevel);
195 char test[] =
"ZDC_monitor";
198 LOG_INFO <<
"StPeCMaker Init: before branch add ---------- " << endm;
202 uDstTree->Branch(
"Trigger",
"StPeCTrigger", &trigger, 64000, 99);
203 uDstTree->Branch(
"Geant",
"StPeCGeant", &geant, 64000, 99);
204 LOG_INFO <<
"StPeCMaker Init: after Geant branch add ---------- " << endm;
205 uDstTree->Branch(
"Event",
"StPeCEvent", &pevent, 64000, 99);
206 LOG_INFO <<
"StPeCMaker Init: after Event branch add ---------- " << endm;
210 TDirectory * saveDir = gDirectory;
211 TDirectory * snapShots = gDirectory->mkdir(
"snapShots");
213 fSnapShots =
new TList();
215 for (Int_t i=0;i<snapLimit;i++){
217 fSnapShots->Add(
new TH2F(Form(
"snapShot%d",i), Form(
"y z view of event %d", i) , 100, -250., 250., 100, -200., 200.));
219 hNumVtx =
new TH1F(
"hNumVtx",
"number of vertices in event" , 10, -0.5, 9.5);
220 hNumAccVtx =
new TH1F(
"hNumAccVtx",
"number of accepted vertices in event" , 10, -0.5, 9.5);
221 hNumAccWithTOF =
new TH1F(
"hNumAccWithTOF",
"number of accepted vertices with at least one TOF hit" , 10, -0.5, 9.5);
222 hNumRejecWithTOF =
new TH1F(
"hNumRejecWithTOF",
"number of rejected vertices with TOF hits" , 10, -0.5, 9.5);
223 hNumTrkRejecVtx =
new TH1F(
"hNumTrkRejecVtx",
"number of tracks in rejected vertex with TOF hits" , 100, 1., 1000.);
224 hzVertexAccTOF =
new TH1F(
"hzVertexAccTOF",
"z vertex accepted with TOF hits" , 100, -200., 200.);
225 hzVertexRejectTOF =
new TH1F(
"hzVertexRejectTOF",
"z vertex rejected with TOF hits" , 100, -200., 200.);
227 fSnapShots->Add(hNumVtx);
228 fSnapShots->Add(hNumAccVtx);
229 fSnapShots->Add(hNumAccWithTOF);
230 fSnapShots->Add(hNumRejecWithTOF);
231 fSnapShots->Add(hNumTrkRejecVtx);
232 fSnapShots->Add(hzVertexAccTOF);
233 fSnapShots->Add(hzVertexRejectTOF);
235 gDirectory = saveDir;
239 LOG_INFO <<
"StPeCMaker leaving Init ---------- " << endm;
240 return StMaker::Init();
244 Int_t StPeCMaker::InitRun(Int_t runnr) {
245 treeFileName=
"StPeCMaker.tree.root";
246 LOG_INFO <<
"InitRun StPeCMaker run " << runnr<<endm;
249 mBTofGeom =
new StBTofGeometry(
"btofGeometry",
"btofGeometry in MatchMaker");
256 if(mBTofGeom && !mBTofGeom->IsInitDone()) {
257 LOG_INFO <<
" BTofGeometry initialization ... " << endm;
259 mBTofGeom->Init(
this, mstarHall);
260 LOG_INFO <<
"starHall defined in StPeCMaker InitRun value of mBTofGeom " << mBTofGeom<<endm;
262 if ( outputPerRun ) {
266 treeFileName = pIOMaker->GetFile();
267 const char* ccc =
"/";
268 Ssiz_t slashPosition = treeFileName.Last(*ccc);
270 if (slashPosition != -1 && slashPosition < treeFileName.Length())
271 treeFileName.Remove(0,slashPosition+1);
275 treeFileName.ReplaceAll(
"dst",
"tree");
276 treeFileName.ReplaceAll(
"event",
"tree");
277 treeFileName.ReplaceAll(
"evtsel",
"treeSel");
279 LOG_INFO <<
"tree output file: " << treeFileName << endm;
282 m_outfile =
new TFile(treeFileName,
"recreate");
283 m_outfile->SetCompressionLevel(1);
284 LOG_INFO <<
"Initrun: open and compression " << endm;
287 LOG_INFO <<
"StPeCMaker leaving InitRun ---------- " << endm;
291 return StMaker::InitRun(runnr);
299 LOG_INFO <<
"StPeCMaker make: just in ---------- " << endm;
311 if(!muDst ) LOG_INFO <<
"StPeCMaker make: muDst not present " << endm;
318 tw = trig.triggerWord();
320 returnValue = trigger->process(muDst, triggerChoice);
322 pevent->setTOFgeometry(mBTofGeom);
323 ok = pevent->fill(muDst);
332 LOG_INFO <<
"StPeCMaker make: using StEvent---------- " << endm;
333 event = (
StEvent *)GetInputDS(
"StEvent");
336 LOG_ERROR <<
"There was no StEvent! Exiting..." << endm;
340 returnValue = trigger->process(event, triggerChoice);
342 StSPtrVecTrackNode& tempn =
event->trackNodes();
343 NTracks = tempn.size();
345 tw =
event->l0Trigger()->triggerWord();
346 pevent->setTOFgeometry(mBTofGeom);
347 ok = pevent->fill(event);
350 if(readStMuDst_and_StEvent){
352 event = (
StEvent *)GetInputDS(
"StEvent");
355 LOG_ERROR <<
"There was no StEvent! Exiting..." << endm;
358 LOG_INFO <<
"StPeCMaker make: using both StMuDst and StEvent ---------- " << endm;
362 tw = trig.triggerWord();
364 returnValue = trigger->process(muDst, triggerChoice);
365 pevent->setTOFgeometry(mBTofGeom);
366 LOG_INFO <<
"StPeCMaker make: using both StMuDst and StEvent mBTofGeom after set " << mBTofGeom<<endm;
368 std::vector<int> v = pevent->fill(event, muDst);
369 LOG_INFO <<
"StPeCMaker make: vector return "<<v.size()<<
" first element "<<v.at(0)<<
" second el: "<<v.at(1)<<
" rejected with TOF hits "<<v.at(2)<<endm;
371 hNumAccVtx->Fill(v.at(0));
372 hNumAccWithTOF->Fill(v.at(1));
373 hNumRejecWithTOF->Fill(v.at(2));
374 hNumVtx->Fill(v.at(3));
375 hNumTrkRejecVtx->Fill(v.at(4));
376 hzVertexAccTOF->Fill(v.at(5));
377 hzVertexRejectTOF->Fill(v.at(6));
381 LOG_INFO <<
"ok returnValue " <<ok<<
" "<<returnValue<< endm;
385 if ( returnValue>0) {
387 LOG_INFO <<
"Fill Event to Tree!**********************" << endm;
388 if(!treeOff)uDstTree->Fill();
423 cout <<
"Entering StPeCMaker::Cuts(StEvent *event, StPeCEvent *pevent)" << endl;
429 if (vtx->position().x() < -5.)
431 if (vtx->position().x() > 5.)
433 if (vtx->position().y() < -5.)
435 if (vtx->position().y() > 5.)
438 if (fabs(vtx->position().z()) > 200.)
442 if (pevent->getNPriPairs() != 1)
446 if (pair->getOpeningAngle() > 3.0)
448 if (pair->getSumCharge())
460 if (pevent->getNTot() != 4)
462 if (fabs(pevent->getZVertex()) > 200)
464 if (pevent->getNPriPairs() != 1)
466 if (pevent->getNSecPairs() != 1)
468 if (pevent->getPriPair(0)->getSumCharge())
470 if (pevent->getSecPair(0)->getSumCharge())
472 if (pevent->getPriPair(0)->getOpeningAngle() > 3)
474 if (pevent->getSecPair(0)->getOpeningAngle() > 3)
486 TDirectory * saveDir = gDirectory;
487 m_outfile->cd(
"snapShots");
489 gDirectory = saveDir;
static TObjArray * globalTracks()
returns pointer to the global tracks list
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
#include "StEventTypes.h"