25 cout <<
"Constructor" << endl;
27 cout <<
"TreeProducerCalibSimul" << endl;
28 cout <<
"xtal in beam = " << xtalInBeam << endl;
29 cout <<
"Fetching hitCollection: " << EBRecHitCollection_.c_str() <<
" prod by " << RecHitProducer_.c_str() <<endl;
30 cout <<
"Fetching hodoCollection: " << hodoRecInfoCollection_.c_str() <<
" prod by " << hodoRecInfoProducer_.c_str() <<endl;
31 cout <<
"Fetching tdcCollection: " << tdcRecInfoCollection_.c_str() <<
" prod by " << tdcRecInfoProducer_.c_str() <<endl;
32 cout <<
"Fetching evHeaCollection: " << eventHeaderCollection_.c_str() <<
" prod by " << eventHeaderProducer_.c_str() <<endl;
42 cout <<
"Deleting" << endl;
55 cout <<
"BeginJob" << endl;
77 cout <<
"EndJob" << endl;
80 ofstream *MyOut =
new ofstream(txtfile_.c_str());
81 *MyOut <<
"total events: " << tot_events << endl;
82 *MyOut <<
"events skipped because of no hits: " << noHits << endl;
83 *MyOut <<
"events skipped because of no hodos: " << noHodo << endl;
84 *MyOut <<
"events skipped because of no tdc: " << noTdc << endl;
85 *MyOut <<
"events skipped because of no header: " << noHeader << endl;
86 *MyOut <<
"total OK events (passing the basic selection): " << tot_events_ok << endl;
103 if ( tot_events%5000 == 0){
cout <<
"event " << tot_events << endl;}
111 iEvent.
getByLabel (RecHitProducer_, EBRecHitCollection_, pEBRecHits) ;
112 EBRecHits = pEBRecHits.
product();
122 iEvent.
getByLabel( hodoRecInfoProducer_, hodoRecInfoCollection_, pHodo);
133 iEvent.
getByLabel( tdcRecInfoProducer_, tdcRecInfoCollection_, pTDC);
144 iEvent.
getByLabel( eventHeaderProducer_ , pEventHeader );
145 evtHeader = pEventHeader.
product();
152 if ( (!EBRecHits) || (EBRecHits->
size() == 0)){ noHits++;
return; }
153 if (!recTDC) { noTdc++;
return; }
154 if (!recHodo) { noHodo++;
return; }
155 if (!evtHeader) { noHeader++;
return; }
168 int nomXtalInBeam = -999;
169 int nextXtalInBeam = -999;
172 if (xtalInBeamId==
EBDetId(0)){
return; }
173 int mySupCry = xtalInBeamId.
ic();
174 int mySupEta = xtalInBeamId.
ieta();
175 int mySupPhi = xtalInBeamId.
iphi();
180 double x = recHodo->
posX();
181 double y = recHodo->
posY();
184 double qx = recHodo->
qualX();
185 double qy = recHodo->
qualY();
190 double tdcOffset = recTDC->
offset();
199 for (
unsigned int icry=0; icry<49; icry++){
200 unsigned int row = icry/7;
201 unsigned int column = icry%7;
206 if ( Xtals7x7[icry].
ism() == 1){
207 energy[icry] = EBRecHits->
find(Xtals7x7[icry])->energy();
208 crystal[icry] = Xtals7x7[icry].
ic();
210 energy[icry] = -100.;
211 crystal[icry] = -100;
228 double maxEne = -999.;
229 int maxEneCry = 9999;
230 int maxEneInMatrix = -999;
231 for (
int ii=0;
ii<49;
ii++){
if (energy[
ii] > maxEne){
233 maxEneCry = crystal[
ii];
234 maxEneInMatrix =
ii;}
244 myTree->fillInfo(run,
event, mySupCry, maxEneCry, nomXtalInBeam, nextXtalInBeam, mySupEta, mySupPhi, tbm, x, y, Xcal, Ycal, sx, sy, qx, qy, tdcOffset, allMatrix, energy, crystal);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
TreeProducerCalibSimul(const edm::ParameterSet &)
int iphi() const
get the crystal iphi
~TreeProducerCalibSimul()
int ieta() const
get the crystal ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const int ETAPHIMODE
int ic() const
get ECAL/crystal number inside SM
T const * product() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
iterator find(key_type k)
static const int SMCRYSTALMODE
int ism(int ieta, int iphi)