CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
ReadCosmicRayData Class Reference

#include <ReadCosmicRayData.h>

+ Inheritance diagram for ReadCosmicRayData:

Public Member Functions

 ReadCosmicRayData (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~ReadCosmicRayData ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 21 of file ReadCosmicRayData.h.

Constructor & Destructor Documentation

◆ ReadCosmicRayData()

ReadCosmicRayData::ReadCosmicRayData ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 60 of file ReadCosmicRayData.cxx.

60 :
61 Algorithm(name,pSvcLocator){
62
63 declareProperty("Dir_file", Dir_file = "input_file.txt");
64 declareProperty("TreeDigi", TreeDigi = "t1");
65 declareProperty("TreeCluster", TreeCluster = "t1");
66 declareProperty("ReadDigi", ReadDigi = true);
67 declareProperty("ReadCluster", ReadCluster = true);
68 declareProperty("DigiSheetID", DigiSheetID = 0);
69 declareProperty("Cut_on_tpc", Cut_on_tpc = false);
70 declareProperty("ClusterSheetID", ClusterSheetID = 0);
71 declareProperty("ClusterRecZ", ClusterRecZ = 0);
72 declareProperty("R_Cluster", R_Cluster = 1.0);
73 declareProperty("Shift_DigitLayerID", Shift_DigitLayerID = 0);
74 declareProperty("Shift_DigitSheetID", Shift_DigitSheetID = 0);
75 declareProperty("Shift_DigitXStripID", Shift_DigitXStripID = 0);
76 declareProperty("Shift_DigitVStripID", Shift_DigitVStripID = 0);
77 declareProperty("Shift_ClusterLayerID", Shift_ClusterLayerID = 0);
78 declareProperty("Shift_ClusterSheetID", Shift_ClusterSheetID = 0);
79 declareProperty("Shift_RecPhi", Shift_RecPhi = 0);
80 declareProperty("Shift_RecV", Shift_RecV = 0);
81 declareProperty("Shift_RecZ", Shift_RecZ = 0);
82 declareProperty("CosmicRayDataSetID", CosmicRayDataSetID = "CR201909");
83 declareProperty("runNo", m_runNo = 1);
84
85 // mapper = new StripMapper(CosmicRayDataSetID);
86}

◆ ~ReadCosmicRayData()

ReadCosmicRayData::~ReadCosmicRayData ( )

Definition at line 88 of file ReadCosmicRayData.cxx.

88 {
89}

Member Function Documentation

◆ execute()

StatusCode ReadCosmicRayData::execute ( )

Definition at line 625 of file ReadCosmicRayData.cxx.

625 {
626
627 MsgStream log(msgSvc(), name());
628 if(ReadDigi&&!ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_D+1<<"/"<<No_Entries_D<<" events are finished !" << endreq;
629 if(!ReadDigi&&ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_C+1<<"/"<<No_Entries_C<<" events are finished !" << endreq;
630 if(ReadDigi&&ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_C+1<<"/"<<No_Entries_C<<" events are finished !" << endreq;
631
632
633 //interface to event data service
634 ISvcLocator* svcLocator = Gaudi::svcLocator();
635 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
636 if (sc.isFailure())
637 cout<<"Could not accesss EventDataSvc!"<<endl;
638
639 // set /Event/EventHeader
640 SmartDataPtr<Event::EventHeader> eventHeader(m_evtSvc,"/Event/EventHeader");
641 if (!eventHeader) {
642 Event::EventHeader *eventHeader = new Event::EventHeader;
643 StatusCode sc = m_evtSvc->registerObject("/Event/EventHeader",eventHeader);
644 }
645 eventHeader->setEventNumber(Ind_Entry_D);
646 eventHeader->setRunNumber( m_runNo);
647
648
649 if(ReadDigi)
650 {
651 DigiEvent* aDigiEvent = new DigiEvent;
652 sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent);
653 if(sc!=StatusCode::SUCCESS) {
654 cout<< "Could not register DigiEvent" <<endl;
655 }
656
657 ReadCgemDigits();
658 SaveCgemDigits();
659 //cout<<"Ind_Entry_D "<<Ind_Entry_D<<", Max_Ind_Entry_D "<<No_Entries_D<<endl;
660
661 if(Ind_Entry_D==No_Entries_D)
662 {
663 log << MSG::INFO << "scheduling a event processing stop...." << endreq;
664 SmartIF<IEventProcessor> ep(serviceLocator());
665 if (ep) ep->stopRun();
666 }
667
668 }
669 if(ReadCluster)
670 {
671 ReconEvent* aReconEvent = new ReconEvent;
672 sc = m_evtSvc->registerObject("/Event/Recon",aReconEvent);
673 if(sc!=StatusCode::SUCCESS) {
674 cout<< "Could not register ReconEvent" <<endl;
675 }
676
677 ReadCgemClusters();
678 SaveCgemClusters();
679 //cout<<"Ind_Entry_C "<<Ind_Entry_C<<", Max_Ind_Entry_C "<<No_Entries_C<<endl;
680 if(Ind_Entry_C==No_Entries_C)
681 {
682 // log << MSG::INFO << "scheduling a event processing stop...." << endreq;
683 SmartIF<IEventProcessor> ep(serviceLocator());
684 if (ep) ep->stopRun();
685 }
686 }
687 return StatusCode::SUCCESS;
688}
IMessageSvc * msgSvc()
void setRunNumber(int value)
Update run number.
Definition EventHeader.h:44
void setEventNumber(int value)
Update event number.
Definition EventHeader.h:39

◆ finalize()

StatusCode ReadCosmicRayData::finalize ( )

const int nlayer = 3; // CHECK hardcoded const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded const int nview = 2; // CHECK hardcoded int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded

int layer=1; int sheet=0; int type=0; for(int strip=0; strip<nstrip[layer][type]; strip++) { cout << strip << " " << mapper->GetGEMROC(strip, type, layer, sheet) << " "
<< mapper->GetFEB(strip, type, layer, sheet) << " " << mapper->GetTIGER(strip, type, layer, sheet) << endl; }

Definition at line 690 of file ReadCosmicRayData.cxx.

690 {
691 MsgStream log(msgSvc(),name());
692 log << MSG::INFO << "ReadCosmicRayData finalize()" << endreq;
693
694 // DEBUG
695 /**
696 const int nlayer = 3; // CHECK hardcoded
697 const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded
698 const int nview = 2; // CHECK hardcoded
699 int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded
700
701 int layer=1;
702 int sheet=0;
703 int type=0;
704 for(int strip=0; strip<nstrip[layer][type]; strip++) {
705 cout << strip << " "
706 << mapper->GetGEMROC(strip, type, layer, sheet) << " "
707 << mapper->GetFEB(strip, type, layer, sheet) << " "
708 << mapper->GetTIGER(strip, type, layer, sheet)
709 << endl;
710 }
711 **/
712 // --------
713
714 return StatusCode::SUCCESS;
715}

◆ initialize()

StatusCode ReadCosmicRayData::initialize ( )
 if(ReadCluster)
 {

Get Cgem cluster tree TString TTreeCluster(TreeCluster); Tcluster = (TTree*)f->Get(TTreeCluster);

Tcluster->SetBranchAddress("Event", &m_Event_C); Tcluster->SetBranchAddress("GemCluster1d_nCluster", &m_nGemCluster); Tcluster->SetBranchAddress("GemCluster1d_nHit", m_ClusternHit); Tcluster->SetBranchAddress("GemCluster1d_HitIndex", m_ClusterHitIndex); Tcluster->SetBranchAddress("GemCluster1d_plane", m_ClusterLayerID); Tcluster->SetBranchAddress("GemCluster1d_view", m_Flag); Tcluster->SetBranchAddress("GemCluster1d_q", m_EnergyDeposit); Tcluster->SetBranchAddress("GemCluster1d_x", m_Cluster_x); Tcluster->SetBranchAddress("GemCluster1d_z", m_Cluster_z); Tcluster->SetBranchAddress("GemCluster1d_x_cc", m_Cluster_x_cc); Tcluster->SetBranchAddress("GemCluster1d_x_tpc", m_Cluster_x_tpc); Tcluster->SetBranchAddress("GemCluster1d_z_cc", m_Cluster_z_cc); Tcluster->SetBranchAddress("GemCluster1d_z_tpc", m_Cluster_z_tpc); Tcluster->SetBranchAddress("ClusterSheetID", m_ClusterSheetID); Tcluster->SetBranchAddress("ClusterFlagB", m_ClusterFlagB); Tcluster->SetBranchAddress("ClusterFlagE", m_ClusterFlagE); Tcluster->SetBranchAddress("RecV", m_RecV); Tcluster->SetBranchAddress("RecZ", m_RecZ);

 No_Entries_C = Tcluster->GetEntries();
 Ind_Entry_C = 0;
 }

Definition at line 91 of file ReadCosmicRayData.cxx.

91 {
92 MsgStream log(msgSvc(), name());
93 log << MSG::INFO << "ReadCosmicRayData initialize()" << endreq;
94
95 // bool ismap = mapper->FillMap();
96
97 TString TDir_file(Dir_file);
98 if(ReadDigi)
99 {
100 TString TTreeDigi(TreeDigi);
101 Tdigi = new TChain(TTreeDigi);
102 TFileCollection* fc = new TFileCollection("mylist", "mylist",TDir_file);
103 Tdigi->AddFileInfoList((TCollection*)fc->GetList());
104
105 // Get Cgem digi tree
106 Tdigi->SetBranchAddress("Event", &m_Event_D); // event ID
107 Tdigi->SetBranchAddress("nGemHit", &m_nGemHit); // nof GEM hits
108 // Tdigi->SetBranchAddress("GemHit_nHit", &m_nGemHit); // nof GEM hits it is the same thing as before
109
110 // information on the IDs
111 Tdigi->SetBranchAddress("GemHit_channel", m_channel); // channel no. [0, 63]
112 Tdigi->SetBranchAddress("GemHit_ROC", m_ROC); // ROC no.
113 Tdigi->SetBranchAddress("GemHit_chip", m_chip); // chip no.
114 Tdigi->SetBranchAddress("GemHit_FEB", m_FEB); // FEB no.
115 Tdigi->SetBranchAddress("GemHit_plane", m_plane); // plane
116 Tdigi->SetBranchAddress("GemHit_sheet", m_sheet); // sheet
117 Tdigi->SetBranchAddress("GemHit_view", m_view); // view (axial or stereo strips)
118 Tdigi->SetBranchAddress("GemHit_strip", m_strip); // strip no.
119
120 // physical information
121 Tdigi->SetBranchAddress("GemHit_saturated", m_saturated); // is the ASIC channel saturated
122 Tdigi->SetBranchAddress("GemHit_q", m_charge); // charge (fC)
123 Tdigi->SetBranchAddress("GemHit_time", m_time); // time (ns)
124 // Tdigi->SetBranchAddress("GemHit_is_tpc", m_GemHit_is_tpc);
125
126 No_Entries_D = Tdigi->GetEntries();
127 cout<<"total Entry is "<<No_Entries_D<<endl;
128 Ind_Entry_D = 0;
129 }
130
131 /**
132 if(ReadCluster)
133 {
134 //Get Cgem cluster tree
135 TString TTreeCluster(TreeCluster);
136 Tcluster = (TTree*)f->Get(TTreeCluster);
137
138 Tcluster->SetBranchAddress("Event", &m_Event_C);
139 Tcluster->SetBranchAddress("GemCluster1d_nCluster", &m_nGemCluster);
140 Tcluster->SetBranchAddress("GemCluster1d_nHit", m_ClusternHit);
141 Tcluster->SetBranchAddress("GemCluster1d_HitIndex", m_ClusterHitIndex);
142 Tcluster->SetBranchAddress("GemCluster1d_plane", m_ClusterLayerID);
143 Tcluster->SetBranchAddress("GemCluster1d_view", m_Flag);
144 Tcluster->SetBranchAddress("GemCluster1d_q", m_EnergyDeposit);
145 Tcluster->SetBranchAddress("GemCluster1d_x", m_Cluster_x);
146 Tcluster->SetBranchAddress("GemCluster1d_z", m_Cluster_z);
147 Tcluster->SetBranchAddress("GemCluster1d_x_cc", m_Cluster_x_cc);
148 Tcluster->SetBranchAddress("GemCluster1d_x_tpc", m_Cluster_x_tpc);
149 Tcluster->SetBranchAddress("GemCluster1d_z_cc", m_Cluster_z_cc);
150 Tcluster->SetBranchAddress("GemCluster1d_z_tpc", m_Cluster_z_tpc);
151 //Tcluster->SetBranchAddress("ClusterSheetID", m_ClusterSheetID);
152 //Tcluster->SetBranchAddress("ClusterFlagB", m_ClusterFlagB);
153 //Tcluster->SetBranchAddress("ClusterFlagE", m_ClusterFlagE);
154 //Tcluster->SetBranchAddress("RecV", m_RecV);
155 //Tcluster->SetBranchAddress("RecZ", m_RecZ);
156
157 No_Entries_C = Tcluster->GetEntries();
158 Ind_Entry_C = 0;
159 }
160 **/
161
162 return StatusCode::SUCCESS;
163}

The documentation for this class was generated from the following files: