CGEM BOSS 6.6.5.i
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 670 of file ReadCosmicRayData.cxx.

670 {
671 MsgStream log(msgSvc(), name());
672 if(ReadDigi&&!ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_D+1<<"/"<<No_Entries_D<<" events are finished !" << endreq;
673 if(!ReadDigi&&ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_C+1<<"/"<<No_Entries_C<<" events are finished !" << endreq;
674 if(ReadDigi&&ReadCluster) log << MSG::INFO << "ReadCosmicRayData execute(): "<<Ind_Entry_C+1<<"/"<<No_Entries_C<<" events are finished !" << endreq;
675
676
677 //interface to event data service
678 ISvcLocator* svcLocator = Gaudi::svcLocator();
679 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
680 if (sc.isFailure())
681 cout<<"Could not accesss EventDataSvc!"<<endl;
682
683 // set /Event/EventHeader
684 SmartDataPtr<Event::EventHeader> eventHeader(m_evtSvc,"/Event/EventHeader");
685 if (!eventHeader) {
686 Event::EventHeader *eventHeader = new Event::EventHeader;
687 StatusCode sc = m_evtSvc->registerObject("/Event/EventHeader",eventHeader);
688 }
689 eventHeader->setEventNumber(Ind_Entry_D);
690 eventHeader->setRunNumber( m_runNo);
691
692
693 if(ReadDigi)
694 {
695 DigiEvent* aDigiEvent = new DigiEvent;
696 sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent);
697 if(sc!=StatusCode::SUCCESS) {
698 cout<< "Could not register DigiEvent" <<endl;
699 }
700
701 ReadCgemDigits();
702 SaveCgemDigits();
703 //cout<<"Ind_Entry_D "<<Ind_Entry_D<<", Max_Ind_Entry_D "<<No_Entries_D<<endl;
704
705 if(Ind_Entry_D==No_Entries_D)
706 {
707 log << MSG::INFO << "scheduling a event processing stop...." << endreq;
708 SmartIF<IEventProcessor> ep(serviceLocator());
709 if (ep) ep->stopRun();
710 }
711
712 }
713 if(ReadCluster)
714 {
715 ReconEvent* aReconEvent = new ReconEvent;
716 sc = m_evtSvc->registerObject("/Event/Recon",aReconEvent);
717 if(sc!=StatusCode::SUCCESS) {
718 cout<< "Could not register ReconEvent" <<endl;
719 }
720
721 ReadCgemClusters();
722 SaveCgemClusters();
723 //cout<<"Ind_Entry_C "<<Ind_Entry_C<<", Max_Ind_Entry_C "<<No_Entries_C<<endl;
724 if(Ind_Entry_C==No_Entries_C)
725 {
726 // log << MSG::INFO << "scheduling a event processing stop...." << endreq;
727 SmartIF<IEventProcessor> ep(serviceLocator());
728 if (ep) ep->stopRun();
729 }
730 }
731 return StatusCode::SUCCESS;
732}
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 734 of file ReadCosmicRayData.cxx.

734 {
735 MsgStream log(msgSvc(),name());
736 log << MSG::INFO << "ReadCosmicRayData finalize()" << endreq;
737
738 // DEBUG
739 /**
740 const int nlayer = 3; // CHECK hardcoded
741 const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded
742 const int nview = 2; // CHECK hardcoded
743 int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded
744
745 int layer=1;
746 int sheet=0;
747 int type=0;
748 for(int strip=0; strip<nstrip[layer][type]; strip++) {
749 cout << strip << " "
750 << mapper->GetGEMROC(strip, type, layer, sheet) << " "
751 << mapper->GetFEB(strip, type, layer, sheet) << " "
752 << mapper->GetTIGER(strip, type, layer, sheet)
753 << endl;
754 }
755 **/
756 // --------
757
758 return StatusCode::SUCCESS;
759}

◆ 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 //Ind_Entry_D = 23790; //Ind_Entry_D = 30200;
130 }
131
132 /**
133 if(ReadCluster)
134 {
135 //Get Cgem cluster tree
136 TString TTreeCluster(TreeCluster);
137 Tcluster = (TTree*)f->Get(TTreeCluster);
138
139 Tcluster->SetBranchAddress("Event", &m_Event_C);
140 Tcluster->SetBranchAddress("GemCluster1d_nCluster", &m_nGemCluster);
141 Tcluster->SetBranchAddress("GemCluster1d_nHit", m_ClusternHit);
142 Tcluster->SetBranchAddress("GemCluster1d_HitIndex", m_ClusterHitIndex);
143 Tcluster->SetBranchAddress("GemCluster1d_plane", m_ClusterLayerID);
144 Tcluster->SetBranchAddress("GemCluster1d_view", m_Flag);
145 Tcluster->SetBranchAddress("GemCluster1d_q", m_EnergyDeposit);
146 Tcluster->SetBranchAddress("GemCluster1d_x", m_Cluster_x);
147 Tcluster->SetBranchAddress("GemCluster1d_z", m_Cluster_z);
148 Tcluster->SetBranchAddress("GemCluster1d_x_cc", m_Cluster_x_cc);
149 Tcluster->SetBranchAddress("GemCluster1d_x_tpc", m_Cluster_x_tpc);
150 Tcluster->SetBranchAddress("GemCluster1d_z_cc", m_Cluster_z_cc);
151 Tcluster->SetBranchAddress("GemCluster1d_z_tpc", m_Cluster_z_tpc);
152 //Tcluster->SetBranchAddress("ClusterSheetID", m_ClusterSheetID);
153 //Tcluster->SetBranchAddress("ClusterFlagB", m_ClusterFlagB);
154 //Tcluster->SetBranchAddress("ClusterFlagE", m_ClusterFlagE);
155 //Tcluster->SetBranchAddress("RecV", m_RecV);
156 //Tcluster->SetBranchAddress("RecZ", m_RecZ);
157
158 No_Entries_C = Tcluster->GetEntries();
159 Ind_Entry_C = 0;
160 }
161 **/
162 return StatusCode::SUCCESS;
163}

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