Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:18:19

0001 #include "KPlus_sig.h"
0002 #include "reaction_routine.h"
0003 #include "TF1.h"
0004 #include "TString.h"
0005 #include "TMath.h"
0006 
0007 double GetKPlus_CrossSection(double ft, double fw, double fqsq, double feps, TString fHadron) {
0008 
0009   double_t sig_total;
0010   
0011   double w,q2,t; // For the sake of testing, I redescribed the fw,fqsq,ft as w,q2,t as I alraedy had a file in my PC to calculate the crossection with these notations
0012   w=fw; q2=fqsq; t=ft;
0013      
0014   int w_1,w_2,q2_1,q2_2; // w_1, rounded value of the input W, w_2 is the next (or previous) value of W. q2_1 is the rounded input value of Q2, q2_2 is the next (or previous) value of Q2 in the array
0015   w_1 = round(w);  
0016   q2_1 = round(q2);
0017 
0018   //....................................................................................................................................................................
0019   // Below are set of if and else if conditions for boundary values of w and q2 
0020   //....................................................................................................................................................................
0021     
0022   if (w == w_1){
0023     w_1 = w;
0024     w_2 = w;
0025     
0026     if (q2 > q2_1){
0027       q2_2 = q2_1 + 1;
0028     }
0029     
0030     else if (q2 < q2_1){
0031       q2_2 = q2_1;
0032       q2_1 = q2_2 -1;
0033     }
0034      
0035     else if (q2 == q2_1 ){
0036       q2_1 = q2;
0037       q2_2 = q2;}     
0038   }
0039    
0040   //................................................................................. 
0041    
0042   else if (w > w_1){
0043     w_2 = w_1 + 1;
0044     
0045     if (q2 > q2_1){
0046       q2_2 = q2_1 + 1;
0047     }
0048     
0049     else if (q2 < q2_1){
0050       q2_2 = q2_1;
0051       q2_1 = q2_2 -1;
0052     }
0053      
0054     else if (q2 == q2_1 ){
0055       q2_1 = q2;
0056       q2_2 = q2;}
0057   }
0058     
0059   //................................................................................... 
0060   else if (w < w_1){
0061     w_2 =w_1;
0062     w_1 = w_2 - 1;
0063       
0064     if (q2 > q2_1){
0065       q2_2 = q2_1 + 1;
0066     }
0067     
0068     else if (q2 < q2_1){
0069       q2_2 = q2_1;
0070       q2_1 = q2_2 -1;
0071     }
0072      
0073     else if (q2 == q2_1 ){
0074       q2_1 = q2;
0075       q2_2 = q2;}
0076   }
0077 
0078   //.................................................................................................................................................................... 
0079   // Calcualtion of t-min values at each w and q2 (i.e. at all the four combinations of w's and q2's ) 
0080   //.................................................................................................................................................................... 
0081   // t1 is the t_min value UNLESS the first fit fails
0082   // If the first fit fails, t2 is the t_min value. If the first fit did NOT fail, t2 is the intersection point between fits 1 and 2
0083   // If the second fit fails, t3 is the t_min value. If the second fit did NOT fail, t3 is the intersection point between fits 2 and 3
0084   
0085   int x_1,x_2,y_1,y_2; // Redefination of w's and q2's as the array start from 0 but w starts from 2 and the q2 starts from 1 in the file.
0086   x_1 = w_1-2;
0087   x_2 = w_2-2;
0088   y_1 = q2_1-1;
0089   y_2 = q2_2-1;  // Till this point variables are same for sigT and sigL
0090 
0091   //....................................................................................................................................................................     
0092   // Variables that need to be defined globally somewhere ( These variables are only for sigT and I have used different variables for sigL)
0093   double t_1,t_2,t_3,t_4; // 4 corners (points) in t to interpolate over
0094   double sigT1,sigT2,sigT3,sigT4; // Value of SigT at each corner of the square to interpolate over
0095   double lsigT1,lsigT2,lsigT3,lsigT4, slb,slt,sll,slr,altb,allr,fsigTLa,fsigTa; // Logarithm of sigma values and slopes along the bottom, top, left, right and the average of the slope along the top/bottom and left/right. fsigTLa is the result in logarithmic form and fsigTa is the result
0096   double sigT11,sigT14; // Bottom left and top right sigma points, these are calculated if there are less than 3 (or 2) points to interpolate over
0097   //...................................................................................................................................................................
0098  
0099  
0100   if(SigPar[1][x_2][y_1][10] != -10001){ // t_3 is t_min for the third corner - this is always the top left corner
0101     t_3 = SigPar[1][x_2][y_1][10];
0102   }
0103   else if (SigPar[1][x_2][y_1][11] != -10001){
0104     t_3 = SigPar[1][x_2][y_1][11];
0105   }
0106   else if (SigPar[1][x_2][y_1][12] != -10001){
0107     t_3 = SigPar[1][x_2][y_1][12];
0108   }
0109   else {
0110     return -100;
0111   }
0112  
0113   //.................................................................................................................................................................... 
0114   // Calcualtion of sigT's at all the corners of the square 
0115   //....................................................................................................................................................................  
0116  
0117   if (t>= t_3 && t<2.0){ // t_3 corner is the one that we will loose at the end
0118 
0119     //Calculating the sigT1 at bottom left corner of the square..................................................................................
0120     if (t>=SigPar[1][x_1][y_1][10] && t<SigPar[1][x_1][y_1][11]){
0121       TF1* parasigT= new TF1("parasigT","pol2");
0122       parasigT->FixParameter(0, SigPar[1][x_1][y_1][2]); 
0123       parasigT->FixParameter(1, SigPar[1][x_1][y_1][3]);
0124       parasigT->FixParameter(2, SigPar[1][x_1][y_1][4]);
0125       sigT1=parasigT->Eval(t);
0126       delete parasigT;
0127       parasigT = NULL;
0128     }
0129      
0130     else if (t>=SigPar[1][x_1][y_1][11] && t<SigPar[1][x_1][y_1][12]){
0131       TF1* parasigT= new TF1("parasigT","pol2");
0132       parasigT->FixParameter(0, SigPar[1][x_1][y_1][5]); 
0133       parasigT->FixParameter(1, SigPar[1][x_1][y_1][6]);
0134       parasigT->FixParameter(2, SigPar[1][x_1][y_1][7]);
0135       sigT1=parasigT->Eval(t); 
0136       delete parasigT;
0137       parasigT = NULL;
0138     }
0139      
0140     else if (t>=SigPar[1][x_1][y_1][12] && t<2.0){
0141       TF1* parasigT= new TF1("parasigT","expo");
0142       parasigT->FixParameter(0, SigPar[1][x_1][y_1][8]); 
0143       parasigT->FixParameter(1, SigPar[1][x_1][y_1][9]);
0144       sigT1=parasigT->Eval(t); 
0145      
0146       if (SigPar[1][x_1][y_1][8] == 0 && SigPar[1][x_1][y_1][9] == 0){
0147     sigT1=0;
0148       }
0149       delete parasigT;
0150       parasigT = NULL;
0151     }
0152      
0153     else {
0154       sigT1=0;
0155     }
0156 
0157     //Calculating the sigT2 at bottom right corner of the square..................................................................................
0158     if (t>=SigPar[1][x_1][y_2][10] && t<SigPar[1][x_1][y_2][11]){
0159       TF1* parasigT= new TF1("parasigT","pol2");
0160       parasigT->FixParameter(0, SigPar[1][x_1][y_2][2]); 
0161       parasigT->FixParameter(1, SigPar[1][x_1][y_2][3]);
0162       parasigT->FixParameter(2, SigPar[1][x_1][y_2][4]);
0163       sigT2=parasigT->Eval(t);
0164       delete parasigT;
0165       parasigT = NULL;
0166     }
0167      
0168     else if (t>=SigPar[1][x_1][y_2][11] && t<SigPar[1][x_1][y_2][12]){
0169       TF1* parasigT= new TF1("parasigT","pol2");
0170       parasigT->FixParameter(0, SigPar[1][x_1][y_2][5]); 
0171       parasigT->FixParameter(1, SigPar[1][x_1][y_2][6]);
0172       parasigT->FixParameter(2, SigPar[1][x_1][y_2][7]);
0173       sigT2=parasigT->Eval(t); 
0174       delete parasigT;
0175       parasigT = NULL;
0176     }
0177      
0178     else if (t>=SigPar[1][x_1][y_2][12] && t<2.0){
0179       TF1* parasigT= new TF1("parasigT","expo");
0180       parasigT->FixParameter(0, SigPar[1][x_1][y_2][8]); 
0181       parasigT->FixParameter(1, SigPar[1][x_1][y_2][9]);
0182       sigT2=parasigT->Eval(t); 
0183      
0184       if (SigPar[1][x_1][y_2][8] == 0 && SigPar[1][x_1][y_2][9] == 0){
0185     sigT2=0;
0186       }
0187       delete parasigT;
0188       parasigT = NULL;
0189     }
0190      
0191     else {
0192       sigT2=0;
0193     }
0194 
0195     //Calculating the sigT3 at top left corner of the square..................................................................................
0196     if (t>=SigPar[1][x_2][y_1][10] && t<SigPar[1][x_2][y_1][11]){
0197       TF1* parasigT= new TF1("parasigT","pol2");
0198       parasigT->FixParameter(0, SigPar[1][x_2][y_1][2]); 
0199       parasigT->FixParameter(1, SigPar[1][x_2][y_1][3]);
0200       parasigT->FixParameter(2, SigPar[1][x_2][y_1][4]);
0201       sigT3=parasigT->Eval(t);
0202       delete parasigT;
0203       parasigT = NULL;
0204     }
0205      
0206     else if (t>=SigPar[1][x_2][y_1][11] && t<SigPar[1][x_2][y_1][12]){
0207       TF1* parasigT= new TF1("parasigT","pol2");
0208       parasigT->FixParameter(0, SigPar[1][x_2][y_1][5]); 
0209       parasigT->FixParameter(1, SigPar[1][x_2][y_1][6]);
0210       parasigT->FixParameter(2, SigPar[1][x_2][y_1][7]);
0211       sigT3=parasigT->Eval(t); 
0212       delete parasigT;
0213       parasigT = NULL;
0214     }
0215      
0216     else if (t>=SigPar[1][x_2][y_1][12] && t<2.0){
0217       TF1* parasigT= new TF1("parasigT","expo");
0218       parasigT->FixParameter(0, SigPar[1][x_2][y_1][8]); 
0219       parasigT->FixParameter(1, SigPar[1][x_2][y_1][9]);
0220       sigT3=parasigT->Eval(t); 
0221      
0222       if (SigPar[1][x_2][y_1][8] == 0 && SigPar[1][x_2][y_1][9] == 0){
0223     sigT3=0;
0224       }
0225       delete parasigT;
0226       parasigT = NULL;
0227     }
0228      
0229     else {
0230       sigT3=0;
0231     }
0232 
0233     //Calculating the sigT4 at top right corner of the square..................................................................................
0234 
0235     if (t>=SigPar[1][x_2][y_2][10] && t<SigPar[1][x_2][y_2][11]){
0236       TF1* parasigT= new TF1("parasigT","pol2");
0237       parasigT->FixParameter(0, SigPar[1][x_2][y_2][2]); 
0238       parasigT->FixParameter(1, SigPar[1][x_2][y_2][3]);
0239       parasigT->FixParameter(2, SigPar[1][x_2][y_2][4]);
0240       sigT4=parasigT->Eval(t);
0241       delete parasigT;
0242       parasigT = NULL;
0243     }
0244      
0245     else if (t>=SigPar[1][x_2][y_2][11] && t<SigPar[1][x_2][y_2][12]){
0246       TF1* parasigT= new TF1("parasigT","pol2");
0247       parasigT->FixParameter(0, SigPar[1][x_2][y_2][5]); 
0248       parasigT->FixParameter(1, SigPar[1][x_2][y_2][6]);
0249       parasigT->FixParameter(2, SigPar[1][x_2][y_2][7]);
0250       sigT4=parasigT->Eval(t); 
0251       delete parasigT;
0252       parasigT = NULL;
0253     }
0254      
0255     else if (t>=SigPar[1][x_2][y_2][12] && t<2.0){
0256       TF1* parasigT= new TF1("parasigT","expo");
0257       parasigT->FixParameter(0, SigPar[1][x_2][y_2][8]); 
0258       parasigT->FixParameter(1, SigPar[1][x_2][y_2][9]);
0259       sigT4=parasigT->Eval(t); 
0260      
0261       if (SigPar[1][x_2][y_2][8] == 0 && SigPar[1][x_2][y_2][9] == 0){
0262     sigT4=0;
0263       }
0264       delete parasigT;
0265       parasigT = NULL;
0266     }
0267      
0268     else {
0269       sigT4=0;
0270     }
0271     //....................................................................................................................................................................
0272     // Difterent if and else conditions to find the crossection values at the given points.
0273     //....................................................................................................................................................................
0274     
0275     if (sigT1 == sigT2 && sigT2 == sigT3 && sigT3 == sigT4 && sigT4 == sigT1){ // if the w and q2 will have whole number values
0276       fsigTa=sigT1;
0277     }   
0278     
0279     //...................................................................................
0280     //...................................................................................
0281 
0282     else if (sigT1 != 0 && sigT2 != 0 && sigT3 != 0 && sigT4 != 0){ // if all the four corners are  present
0283    
0284       if (fHadron ==  "Lambda"){// Taking the log of claculated sigT values    
0285     lsigT1 = TMath::Log(sigT1); //log value of sigT1.
0286     lsigT2 = TMath::Log(sigT2); //log value of sigT2.
0287     lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0288     lsigT4 = TMath::Log(sigT4); //log value of sigT4.
0289     // Calculated slopes of different lines
0290     slb = lsigT4-lsigT3; //interpolation from the third corner (i.e. top left corner)
0291     slt = lsigT2-lsigT1;
0292     sll = -(lsigT1-lsigT3);
0293     slr = -(lsigT2-lsigT4);
0294     // Taking averages of the slopes
0295     altb = ((slb +slt)/2 );
0296     allr = ((sll +slr)/2 );
0297         
0298     //  Applying taylor's series formula for the average slopes
0299     fsigTLa = lsigT3 + (q2-q2_1)*altb + (w-w_2)*allr;
0300       
0301     // Find the anti-log of the taylor's series formula value  
0302     fsigTa = exp(fsigTLa);
0303       } 
0304     
0305       //.............................................................................................
0306       // For Sigma Channel interpolation can happen from either from the 3rd corner or the 4th corner
0307       //.............................................................................................
0308 
0309       else if (fHadron ==  "Sigma0"){
0310 
0311     if(w < w_1 +0.5){ // interpolation from fourth corner
0312    
0313       // Taking the log of claculated sigT values    
0314       lsigT1 = TMath::Log(sigT1); //log value of sigT1.
0315       lsigT2 = TMath::Log(sigT2); //log value of sigT2.
0316       lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0317       lsigT4 = TMath::Log(sigT4); //log value of sigT4.
0318       // Calculated slopes of different lines
0319       slb = -(lsigT3-lsigT4); //interpolation from the fourth corner (i.e. top right corner)
0320       slt = -(lsigT1-lsigT2);
0321       sll = -(lsigT2-lsigT4);
0322       slr = -(lsigT1-lsigT3);
0323       // Taking averages of the slopes
0324       altb = ((slb +slt)/2 );
0325       allr = ((sll +slr)/2 );
0326         
0327       //  Applying taylor's series formula for the average slopes
0328       fsigTLa = lsigT4 + (q2-q2_2)*altb + (w-w_2)*allr;
0329       
0330       // Find the anti-log of the taylor's series formula value  
0331       fsigTa = exp(fsigTLa);
0332     }
0333     
0334     else if(w >= w_1 +0.5){ // interpolation from third corner
0335    
0336       // Taking the log of claculated sigT values    
0337       lsigT1 = TMath::Log(sigT1); //log value of sigT1.
0338       lsigT2 = TMath::Log(sigT2); //log value of sigT2.
0339       lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0340       lsigT4 = TMath::Log(sigT4); //log value of sigT4.
0341       // Calculated slopes of different lines
0342       slb = lsigT4-lsigT3; //interpolation from the third corner (i.e. top left corner)
0343       slt = lsigT2-lsigT1;
0344       sll = -(lsigT1-lsigT3);
0345       slr = -(lsigT2-lsigT4);
0346       // Taking averages of the slopes
0347       altb = ((slb +slt)/2 );
0348       allr = ((sll +slr)/2 );
0349         
0350       //  Applying taylor's series formula for the average slopes
0351       fsigTLa = lsigT3 + (q2-q2_1)*altb + (w-w_2)*allr;
0352       
0353       // Find the anti-log of the taylor's series formula value  
0354       fsigTa = exp(fsigTLa);
0355     }
0356 
0357       }
0358 
0359     }
0360     //...................................................................................
0361     //...................................................................................
0362 
0363     else if (sigT1 == 0 && sigT2 == 0 && sigT4 == 0)  // if we loose the 1st, 2nd and the 4th corner simultaneously 
0364       {
0365     // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) will always be there and for other two corners, find the value of the cross-section at the first and the fourth corner at the minimum value of t. After that we can interpolate them.
0366 
0367     // First try to find t_1 and t_4 
0368 
0369     if(SigPar[1][x_1][y_1][10] != -10001){ // t_1 is t_min for the first corner - this is always the bottom left corner
0370       t_1 = SigPar[1][x_1][y_1][10];
0371     }
0372     else if (SigPar[1][x_1][y_1][11] != -10001){
0373       t_1 =  SigPar[1][x_1][y_1][11];
0374     } 
0375     else if ( SigPar[1][x_1][y_1][12] != -10001){
0376       t_1 =  SigPar[1][x_1][y_1][12];
0377     }
0378     else {
0379       return -100;
0380     }
0381  
0382     //...................................................................................  
0383     if(SigPar[1][x_2][y_2][10] != -10001){  // t_4 is t_min for the fourth corner - this is always the top right corner
0384       t_4 = SigPar[1][x_2][y_2][10];
0385     }
0386     else if (SigPar[1][x_2][y_2][11] != -10001){
0387       t_4 =SigPar[1][x_2][y_2][11];
0388     }
0389     else if (SigPar[1][x_2][y_2][12] != -10001){
0390       t_4 = SigPar[1][x_2][y_2][12];
0391     }
0392     else {
0393       return -100;
0394     }
0395 
0396     //Calculating the sigT11 at bottom left corner of the square      
0397     if (t_1>=SigPar[1][x_1][y_1][10]&& t_1<SigPar[1][x_1][y_1][11]){ 
0398       TF1* parasigT= new TF1("parasigT","pol2");
0399       parasigT->FixParameter(0, SigPar[1][x_1][y_1][2]); 
0400       parasigT->FixParameter(1, SigPar[1][x_1][y_1][3]);
0401       parasigT->FixParameter(2, SigPar[1][x_1][y_1][4]);
0402       sigT11=parasigT->Eval(t_1);
0403           delete parasigT;
0404           parasigT = NULL;
0405     }
0406      
0407     else if (t_1>=SigPar[1][x_1][y_1][11] && t_1<SigPar[1][x_1][y_1][12]){
0408       TF1* parasigT= new TF1("parasigT","pol2");
0409       parasigT->FixParameter(0,SigPar[1][x_1][y_1][5]); 
0410       parasigT->FixParameter(1,SigPar[1][x_1][y_1][6]);
0411       parasigT->FixParameter(2,SigPar[1][x_1][y_1][7]);
0412       sigT11=parasigT->Eval(t_1); 
0413           delete parasigT;
0414           parasigT = NULL;
0415     } 
0416     
0417     else if (t_1>=SigPar[1][x_1][y_1][12] && t_1<2.0){
0418       TF1* parasigT= new TF1("parasigT","expo");
0419       parasigT->FixParameter(0, SigPar[1][x_1][y_1][8]); 
0420       parasigT->FixParameter(1, SigPar[1][x_1][y_1][9]);
0421       sigT11=parasigT->Eval(t_1); 
0422       
0423       if (SigPar[1][x_1][y_1][8] == 0 && SigPar[1][x_1][y_1][9] == 0){
0424         sigT11 =0;
0425       }
0426           delete parasigT;
0427           parasigT = NULL;
0428     }
0429      
0430     else {
0431       sigT11=0;
0432     }
0433 
0434     //Calculating the sigT14 at bottom left corner of the square
0435    
0436     if (t_4>=SigPar[1][x_2][y_2][10]&& t_4<SigPar[1][x_2][y_2][11]){ 
0437       TF1* parasigT= new TF1("parasigT","pol2");
0438       parasigT->FixParameter(0, SigPar[1][x_2][y_2][2]); 
0439       parasigT->FixParameter(1, SigPar[1][x_2][y_2][3]);
0440       parasigT->FixParameter(2, SigPar[1][x_2][y_2][4]);
0441       sigT14=parasigT->Eval(t_4);
0442           delete parasigT;
0443           parasigT = NULL;
0444     }
0445      
0446     else if (t_4>=SigPar[1][x_2][y_2][11] && t_1<SigPar[1][x_2][y_2][12]){
0447       TF1* parasigT= new TF1("parasigT","pol2");
0448       parasigT->FixParameter(0,SigPar[1][x_2][y_2][5]); 
0449       parasigT->FixParameter(1,SigPar[1][x_2][y_2][6]);
0450       parasigT->FixParameter(2,SigPar[1][x_2][y_2][7]);
0451       sigT14=parasigT->Eval(t_4); 
0452           delete parasigT;
0453           parasigT = NULL;
0454     } 
0455     
0456     else if (t_4>=SigPar[1][x_1][y_1][12] && t_1<2.0){
0457       TF1* parasigT= new TF1("parasigT","expo");
0458       parasigT->FixParameter(0, SigPar[1][x_2][y_2][8]); 
0459       parasigT->FixParameter(1, SigPar[1][x_2][y_2][9]);
0460       sigT14=parasigT->Eval(t_4); 
0461       
0462       if (SigPar[1][x_2][y_2][8] == 0 && SigPar[1][x_2][y_2][9] == 0){
0463         sigT14 =0;
0464       }
0465           
0466           delete parasigT;
0467           parasigT = NULL;
0468     }
0469      
0470     else {
0471       sigT14=0;
0472     }
0473 
0474     // Taking the log of claculated sigT values
0475     lsigT1 = TMath::Log(sigT11); //log value of sigT11.
0476     lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0477     lsigT4 = TMath::Log(sigT14); //log value of sigT14.
0478     // Calculated slopes of different lines
0479     slb = lsigT4-lsigT3; //->interpolation from the third corner
0480     sll = -(lsigT1-lsigT3);
0481       
0482     // Applying taylor's series formula without averaging the slopes        
0483     fsigTLa = lsigT3 + (q2-q2_1)*slb + (w-w_2)*sll; //->interpolation from the third corner
0484   
0485     // Find the anti-log of the taylor's series formula value 
0486         fsigTa = exp(fsigTLa);
0487       }
0488     //...................................................................................
0489     //...................................................................................
0490 
0491     else if (sigT1 == 0 && sigT2 == 0){  // if we loose the 1st and the 2nd corner simultaneously
0492       // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) and the fourth corner (i.e. top right)will always be there and for other one corner, find the value of the cross-section at the first corner at the minimum value of t. After that we can interpolate them.
0493 
0494       // First try to find t_1
0495 
0496       if(SigPar[1][x_1][y_1][10] != -10001){ // t_1 is t_min for the first corner - this is always the bottom left corner
0497     t_1 = SigPar[1][x_1][y_1][10];
0498       }
0499       else if (SigPar[1][x_1][y_1][11] != -10001){
0500     t_1 =  SigPar[1][x_1][y_1][11];
0501       } 
0502       else if ( SigPar[1][x_1][y_1][12] != -10001){
0503     t_1 =  SigPar[1][x_1][y_1][12];
0504       }
0505       else {
0506     return -100;
0507       } 
0508      
0509       //Calculating the sigT11 at bottom left corner of the square
0510       if (t_1>=SigPar[1][x_1][y_1][10]&& t_1<SigPar[1][x_1][y_1][11]){ 
0511     TF1* parasigT= new TF1("parasigT","pol2");
0512     parasigT->FixParameter(0, SigPar[1][x_1][y_1][2]); 
0513     parasigT->FixParameter(1, SigPar[1][x_1][y_1][3]);
0514     parasigT->FixParameter(2, SigPar[1][x_1][y_1][4]);
0515     sigT11=parasigT->Eval(t_1);
0516         
0517         delete parasigT;
0518         parasigT = NULL;
0519       }
0520      
0521       else if (t_1>=SigPar[1][x_1][y_1][11] && t_1<SigPar[1][x_1][y_1][12]){
0522     TF1* parasigT= new TF1("parasigT","pol2");
0523     parasigT->FixParameter(0,SigPar[1][x_1][y_1][5]); 
0524     parasigT->FixParameter(1,SigPar[1][x_1][y_1][6]);
0525     parasigT->FixParameter(2,SigPar[1][x_1][y_1][7]);
0526     sigT11=parasigT->Eval(t_1);
0527     
0528     delete parasigT;
0529     parasigT = NULL; 
0530       } 
0531     
0532       else if (t_1>=SigPar[1][x_1][y_1][12] && t_1<2.0){
0533     TF1* parasigT= new TF1("parasigT","expo");
0534     parasigT->FixParameter(0, SigPar[1][x_1][y_1][8]); 
0535     parasigT->FixParameter(1, SigPar[1][x_1][y_1][9]);
0536     sigT11=parasigT->Eval(t_1);       
0537     if (SigPar[1][x_1][y_1][8] == 0 && SigPar[1][x_1][y_1][9] == 0){
0538       sigT11 =0;
0539     }
0540     
0541     delete parasigT;
0542     parasigT = NULL;
0543       }
0544      
0545       else {
0546     sigT11=0;
0547       }
0548       // Taking the log of claculated sigT values
0549        
0550       lsigT1 = TMath::Log(sigT11); //log value of sigT11.
0551       lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0552       lsigT4 = TMath::Log(sigT4); //log value of sigT4.
0553       // Calculated slopes of different lines
0554       slb = lsigT4-lsigT3; //->interpolation from the third corner
0555       sll = -(lsigT1-lsigT3);
0556       // Applying taylor's series formula without averaging the slopes
0557       fsigTLa = lsigT3 + (q2-q2_1)*slb + (w-w_2)*sll; //->interpolation from the third corner
0558         
0559       // Find the anti-log of the taylor's series formula value         
0560       fsigTa = exp(fsigTLa);
0561     }   
0562     //...................................................................................
0563     //...................................................................................
0564 
0565     else if (sigT4 == 0 && sigT2 == 0){  // if we loose the 4th and the 2nd corner simultaneously
0566       // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) and the first corner (i.e. top right) will always be there and for other one corner, find the value of the cross-section at the fourth corner at the minimum value of t. After that we can interpolate them.
0567 
0568       // First try to find t_4
0569 
0570       if(SigPar[1][x_2][y_2][10] != -10001){  // t_4 is t_min for the fourth corner - this is always the top right corner
0571     t_4 = SigPar[1][x_2][y_2][10];
0572       }
0573       else if (SigPar[1][x_2][y_2][11] != -10001){
0574     t_4 =SigPar[1][x_2][y_2][11];
0575       }
0576       else if (SigPar[1][x_2][y_2][12] != -10001){
0577     t_4 = SigPar[1][x_2][y_2][12];
0578       }
0579       else {
0580     return -100;
0581       }
0582       //Calculating the sigT14 at bottom left corner of the square
0583    
0584       if (t_4>=SigPar[1][x_2][y_2][10]&& t_4<SigPar[1][x_2][y_2][11]){ 
0585     TF1* parasigT= new TF1("parasigT","pol2");
0586     parasigT->FixParameter(0, SigPar[1][x_2][y_2][2]); 
0587     parasigT->FixParameter(1, SigPar[1][x_2][y_2][3]);
0588     parasigT->FixParameter(2, SigPar[1][x_2][y_2][4]);
0589     sigT14=parasigT->Eval(t_4);
0590     
0591     delete parasigT;
0592     parasigT = NULL;
0593       }
0594      
0595       else if (t_4>=SigPar[1][x_2][y_2][11] && t_1<SigPar[1][x_2][y_2][12]){
0596     TF1* parasigT= new TF1("parasigT","pol2");
0597     parasigT->FixParameter(0,SigPar[1][x_2][y_2][5]); 
0598     parasigT->FixParameter(1,SigPar[1][x_2][y_2][6]);
0599     parasigT->FixParameter(2,SigPar[1][x_2][y_2][7]);
0600     sigT14=parasigT->Eval(t_4); 
0601     
0602     delete parasigT;
0603     parasigT = NULL;
0604       } 
0605     
0606       else if (t_4>=SigPar[1][x_1][y_1][12] && t_1<2.0){
0607     TF1* parasigT= new TF1("parasigT","expo");
0608     parasigT->FixParameter(0, SigPar[1][x_2][y_2][8]); 
0609     parasigT->FixParameter(1, SigPar[1][x_2][y_2][9]);
0610     sigT14=parasigT->Eval(t_4); 
0611       
0612     if (SigPar[1][x_2][y_2][8] == 0 && SigPar[1][x_2][y_2][9] == 0){
0613       sigT14 =0;
0614     }
0615     
0616     delete parasigT;
0617     parasigT = NULL;
0618       }
0619      
0620       else {
0621     sigT14=0;
0622       }
0623      
0624  
0625       // Taking the log of claculated sigT values
0626        
0627       lsigT1 = TMath::Log(sigT1); //log value of sigT11.
0628       lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0629       lsigT4 = TMath::Log(sigT14); //log value of sigT4.
0630       // Calculated slopes of different lines
0631       slb = lsigT4-lsigT3; //->interpolation from the third corner
0632       sll = -(lsigT1-lsigT3);
0633       // Applying taylor's series formula without averaging the slopes
0634       fsigTLa = lsigT3 + (q2-q2_1)*slb + (w-w_2)*sll; //->interpolation from the third corner
0635         
0636       // Find the anti-log of the taylor's series formula value         
0637       fsigTa = exp(fsigTLa);
0638     }      
0639        
0640 
0641     //..............................................................................
0642     //...................................................................................
0643 
0644     else if (sigT2 == 0) { // if we loose 2nd corner, first we will always loose this corner as this correspond to highest -t value (interpolate from 3rd corner)
0645       // In this case, we will need atleat three corners to find the cross-section. And even after loosing second corner, we still have three corners to interpolate.
0646 
0647       // Taking the log of claculated sigT values         
0648       lsigT1 = TMath::Log(sigT1); //log value of sigT1.
0649       lsigT3 = TMath::Log(sigT3); //log value of sigT3.
0650       lsigT4 = TMath::Log(sigT4); //log value of sigT4.
0651     
0652       // Calculated slopes of different lines
0653       slb = lsigT4-lsigT3; //->interpolation from the third corner
0654       sll = -(lsigT1-lsigT3);
0655         
0656       // Applying taylor's series formula without averaging the slopes  
0657       fsigTLa = lsigT3 + (q2-q2_1)*slb + (w-w_2)*sll; //->interpolation from the third corner
0658       
0659       // Find the anti-log of the taylor's series formula value       
0660       fsigTa = exp(fsigTLa);
0661     }     
0662 
0663     //...................................................................................
0664     //...................................................................................
0665             
0666   } // end of if statement over t
0667   //....................................................................................................................................................................
0668   else{
0669     //cerr<<" Invalid t-value "<<endl;
0670     return -100;
0671   }      
0672    
0673   //....................................................................................................................................................................
0674   //.................................................................................................................................................................... 
0675   //....................................................................................................................................................................
0676   //.................................................................................................................................................................... 
0677   // Calcualtion of t-min values at each w and q2 (i.e. at all the four combinations of w's and q2's ) [SigL Calculations started from here]
0678   //....................................................................................................................................................................
0679   //.................................................................................................................................................................... 
0680   //....................................................................................................................................................................
0681   //.................................................................................................................................................................... 
0682   // t1 is the t_min value UNLESS the first fit fails
0683   // If the first fit fails, t2 is the t_min value. If the first fit did NOT fail, t2 is the intersection point between fits 1 and 2
0684   // If the second fit fails, t3 is the t_min value. If the second fit did NOT fail, t3 is the intersection point between fits 2 and 3
0685  
0686   //....................................................................................................................................................................     
0687   // Variables that need to be defined globally somewhere ( These variables are only for sigL)
0688   double l_1,l_2,l_3,l_4; // 4 corners (points) in t to interpolate over
0689   double sigL1,sigL2,sigL3,sigL4; // Value of SigL at each corner of the square to interpolate over
0690   double lsigL1,lsigL2,lsigL3,lsigL4, stb,stt,stl,str,attb,atlr,fsigLLa,fsigLa; // Logarithm of sigma values and slopes along the bottom, top, left, right and the average of the slope along the top/bottom and left/right. fsigTLa is the result in logarithmic form and fsigTa is the result
0691   double sigL11,sigL14; // Bottom left and top right sigma points, these are calculated if there are less than 3 (or 2) points to interpolate over
0692   //...................................................................................................................................................................
0693        
0694   if(SigPar[0][x_2][y_1][9] != -10001){ // l_3 is t_min for the third corner - this is always the top left corner
0695     l_3 = SigPar[0][x_2][y_1][9];
0696   }
0697   else if (SigPar[0][x_2][y_1][10] != -10001){
0698     l_3 = SigPar[0][x_2][y_1][10];
0699   }
0700   else if (SigPar[0][x_2][y_1][11] != -10001){
0701     l_3 = SigPar[0][x_2][y_1][11];
0702   }
0703   else {
0704     return -100;
0705   } 
0706   
0707   //.................................................................................................................................................................... 
0708   // Calcualtion of sigL's at all the corners of the square 
0709   //....................................................................................................................................................................  
0710  
0711   if (t>= l_3 && t<2.0){ // l_3 corner is the one that we will loose at the end
0712 
0713     //Calculating the sigL1 at bottom left corner of the square..................................................................................
0714     if (t>=SigPar[0][x_1][y_1][9] && t<SigPar[0][x_1][y_1][10]){
0715       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
0716     TF1* parasigL= new TF1("parasigL","expo");
0717     parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
0718     parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
0719     sigL1=parasigL->Eval(t);
0720     if (SigPar[0][x_1][y_1][2] == 0 && SigPar[0][x_1][y_1][3] == 0){
0721       sigL1=0;
0722     }
0723         
0724         delete parasigL;
0725         parasigL = NULL;
0726       }
0727       
0728       else{
0729     TF1* parasigL= new TF1("parasigL","pol2");
0730     parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
0731     parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
0732     parasigL->FixParameter(2, SigPar[0][x_1][y_1][4]);
0733     sigL1=parasigL->Eval(t);
0734         
0735         delete parasigL;
0736         parasigL = NULL;
0737       }
0738       
0739     }
0740      
0741     else if (t>=SigPar[0][x_1][y_1][10] && t<SigPar[0][x_1][y_1][11]){
0742       TF1* parasigL= new TF1("parasigL","expo");
0743       parasigL->FixParameter(0, SigPar[0][x_1][y_1][5]); 
0744       parasigL->FixParameter(1, SigPar[0][x_1][y_1][6]);
0745       sigL1=parasigL->Eval(t);
0746       if (SigPar[0][x_1][y_1][5] == 0 && SigPar[0][x_1][y_1][6] == 0){
0747     sigL1=0;
0748       }
0749       
0750       delete parasigL;
0751       parasigL = NULL;
0752     }
0753      
0754     else if (t>=SigPar[0][x_1][y_1][11] && t<2.0){
0755       TF1* parasigL= new TF1("parasigT","expo");
0756       parasigL->FixParameter(0, SigPar[0][x_1][y_1][7]); 
0757       parasigL->FixParameter(1, SigPar[0][x_1][y_1][8]);
0758       sigL1=parasigL->Eval(t);
0759       if (SigPar[0][x_1][y_1][7] == 0 && SigPar[0][x_1][y_1][8] == 0){
0760     sigL1=0;
0761       }
0762       
0763       delete parasigL;
0764       parasigL = NULL;
0765     }
0766      
0767     else {
0768       sigL1=0;
0769     }
0770 
0771     //Calculating the sigL2 at bottom right corner of the square..................................................................................
0772 
0773     if (t>=SigPar[0][x_1][y_2][9] && t<SigPar[0][x_1][y_2][10]){
0774       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
0775     TF1* parasigL= new TF1("parasigL","expo");
0776     parasigL->FixParameter(0, SigPar[0][x_1][y_2][2]); 
0777     parasigL->FixParameter(1, SigPar[0][x_1][y_2][3]);
0778     sigL2=parasigL->Eval(t);
0779     if (SigPar[0][x_1][y_2][2] == 0 && SigPar[0][x_1][y_2][3] == 0){
0780       sigL2=0;
0781     }
0782         
0783         delete parasigL;
0784         parasigL = NULL;
0785       }
0786       
0787       else{
0788     TF1* parasigL= new TF1("parasigL","pol2");
0789     parasigL->FixParameter(0, SigPar[0][x_1][y_2][2]); 
0790     parasigL->FixParameter(1, SigPar[0][x_1][y_2][3]);
0791     parasigL->FixParameter(2, SigPar[0][x_1][y_2][4]);
0792     sigL2=parasigL->Eval(t);
0793         
0794     delete parasigL;
0795     parasigL = NULL;
0796       }
0797     }
0798      
0799     else if (t>=SigPar[0][x_1][y_2][10] && t<SigPar[0][x_1][y_2][11]){
0800       TF1* parasigL= new TF1("parasigL","expo");
0801       parasigL->FixParameter(0, SigPar[0][x_1][y_2][5]); 
0802       parasigL->FixParameter(1, SigPar[0][x_1][y_2][6]);
0803       sigL2=parasigL->Eval(t); 
0804       if (SigPar[0][x_1][y_2][5] == 0 && SigPar[0][x_1][y_2][6] == 0){
0805     sigL2=0;
0806       }
0807       
0808       delete parasigL;
0809       parasigL = NULL;
0810     }
0811      
0812     else if (t>=SigPar[0][x_1][y_2][11] && t<2.0){
0813       TF1* parasigL= new TF1("parasigT","expo");
0814       parasigL->FixParameter(0, SigPar[0][x_1][y_2][7]); 
0815       parasigL->FixParameter(1, SigPar[0][x_1][y_2][8]);
0816       sigL2=parasigL->Eval(t);
0817       if (SigPar[0][x_1][y_2][7] == 0 && SigPar[0][x_1][y_2][8] == 0){
0818     sigL2=0;
0819       }
0820       
0821       delete parasigL;
0822       parasigL = NULL;
0823     }
0824      
0825     else {
0826       sigL2=0;
0827     }
0828 
0829     //Calculating the sigL3 at top left corner of the square..................................................................................
0830     if (t>=SigPar[0][x_2][y_1][9] && t<SigPar[0][x_2][y_1][10]){
0831       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
0832     TF1* parasigL= new TF1("parasigL","expo");
0833     parasigL->FixParameter(0, SigPar[0][x_2][y_1][2]); 
0834     parasigL->FixParameter(1, SigPar[0][x_2][y_1][3]);
0835     sigL3=parasigL->Eval(t); 
0836      
0837     if (SigPar[0][x_2][y_1][2] == 0 && SigPar[0][x_2][y_1][3] == 0){
0838       sigL3=0;
0839     }
0840         
0841     delete parasigL;
0842     parasigL = NULL;
0843       }
0844       
0845       else{
0846     TF1* parasigL= new TF1("parasigL","pol2");
0847     parasigL->FixParameter(0, SigPar[0][x_2][y_1][2]); 
0848     parasigL->FixParameter(1, SigPar[0][x_2][y_1][3]);
0849     parasigL->FixParameter(2, SigPar[0][x_2][y_1][4]);
0850     sigL3=parasigL->Eval(t);
0851         
0852         delete parasigL;
0853         parasigL = NULL;
0854       }
0855      
0856     }
0857      
0858     else if (t>=SigPar[0][x_2][y_1][10] && t<SigPar[0][x_2][y_1][11]){
0859       TF1* parasigL= new TF1("parasigL","expo");
0860       parasigL->FixParameter(0, SigPar[0][x_2][y_1][5]); 
0861       parasigL->FixParameter(1, SigPar[0][x_2][y_1][6]);
0862       sigL3=parasigL->Eval(t); 
0863       
0864       if (SigPar[0][x_2][y_1][5] == 0 && SigPar[0][x_2][y_1][6] == 0){
0865     sigL3=0;
0866       }
0867       
0868       delete parasigL;
0869       parasigL = NULL;
0870     }
0871      
0872     else if (t>=SigPar[0][x_2][y_1][11] && t<2.0){
0873       TF1* parasigL= new TF1("parasigT","expo");
0874       parasigL->FixParameter(0, SigPar[0][x_2][y_1][7]); 
0875       parasigL->FixParameter(1, SigPar[0][x_2][y_1][8]);
0876       sigL3=parasigL->Eval(t); 
0877      
0878       if (SigPar[0][x_2][y_1][7] == 0 && SigPar[0][x_2][y_1][8] == 0){
0879     sigL3=0;
0880       }
0881       
0882       delete parasigL;
0883       parasigL = NULL;
0884     }
0885      
0886     else {
0887       sigL3=0;
0888     }
0889 
0890     //Calculating the sigL4 at top right corner of the square..................................................................................
0891     if (t>=SigPar[0][x_2][y_2][9] && t<SigPar[0][x_2][y_2][10]){
0892       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
0893     TF1* parasigL= new TF1("parasigL","expo");
0894     parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
0895     parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
0896     sigL4=parasigL->Eval(t); 
0897      
0898     if (SigPar[0][x_2][y_2][2] == 0 && SigPar[0][x_2][y_2][3] == 0){
0899       sigL4=0;
0900     }
0901         
0902     delete parasigL;
0903     parasigL = NULL;
0904       }
0905       
0906       else{
0907     TF1* parasigL= new TF1("parasigL","pol2");
0908     parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
0909     parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
0910     parasigL->FixParameter(2, SigPar[0][x_2][y_2][4]);
0911     sigL4=parasigL->Eval(t);
0912        
0913     delete parasigL;
0914      parasigL = NULL;
0915       }
0916      
0917     }
0918      
0919     else if (t>=SigPar[0][x_2][y_2][10] && t<SigPar[0][x_2][y_2][11]){
0920       TF1* parasigL= new TF1("parasigL","expo");
0921       parasigL->FixParameter(0, SigPar[0][x_2][y_2][5]); 
0922       parasigL->FixParameter(1, SigPar[0][x_2][y_2][6]);
0923       sigL4=parasigL->Eval(t); 
0924       
0925       if (SigPar[0][x_2][y_2][5] == 0 && SigPar[0][x_2][y_2][6] == 0){
0926     sigL4=0;
0927       }
0928       
0929       delete parasigL;
0930       parasigL = NULL;
0931     }
0932      
0933     else if (t>=SigPar[0][x_2][y_2][11] && t<2.0){
0934       TF1* parasigL= new TF1("parasigT","expo");
0935       parasigL->FixParameter(0, SigPar[0][x_2][y_2][7]); 
0936       parasigL->FixParameter(1, SigPar[0][x_2][y_2][8]);
0937       sigL4=parasigL->Eval(t); 
0938      
0939       if (SigPar[0][x_2][y_2][7] == 0 && SigPar[0][x_2][y_2][8] == 0){
0940     sigL4=0;
0941       }
0942       
0943       delete parasigL;
0944       parasigL = NULL;
0945     }
0946      
0947     else {
0948       sigL4=0;
0949     }
0950 
0951     //....................................................................................................................................................................
0952     // Difterent if and else conditions to find the crossection values at the given points.
0953     //....................................................................................................................................................................
0954     
0955     if (sigL1 == sigL2 && sigL2 == sigL3 && sigL3 == sigL4 && sigL4 == sigL1){ // if the w and q2 will have whole number values
0956       fsigLa = sigL1;
0957     }   
0958     
0959     //...................................................................................
0960     //...................................................................................
0961 
0962     else if (sigL1 != 0 && sigL2 != 0 && sigL3 != 0 && sigL4 != 0){ // if all the four corners are  present
0963     
0964       // Taking the log of claculated sigT values
0965       lsigL1 = TMath::Log(sigL1); //log value of sigT1.
0966       lsigL2 = TMath::Log(sigL2); //log value of sigT2.
0967       lsigL3 = TMath::Log(sigL3); //log value of sigT3.
0968       lsigL4 = TMath::Log(sigL4); //log value of sigT4.
0969      
0970       // Calculated slopes of different lines
0971        
0972       stb = lsigL4-lsigL3; //interpolation from the third corner (i.e. top left corner)
0973       stt = lsigL2-lsigL1;
0974       stl = -(lsigL1-lsigL3);
0975       str = -(lsigL2-lsigL4);
0976         
0977       // Taking averages of the slopes
0978         
0979       attb = ((stb +stt)/2 );
0980       atlr = ((stl +str)/2 );
0981         
0982       //  Applying taylor's series formula for the average slopes
0983         
0984       fsigLLa = lsigL3 + (q2-q2_1)*attb + (w-w_2)*atlr;
0985         
0986       // Find the anti-log of the taylor's series formula value
0987       fsigLa = exp(fsigLLa);
0988     }
0989     //...................................................................................
0990     //...................................................................................
0991 
0992     else if (sigL1 == 0 && sigL2 == 0 && sigL4 == 0)  // if we loose the 1st, 2nd and the 4th corner simultaneously 
0993       {
0994     // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) will always be there and for other two corners, find the value of the cross-section at the first and the fourth corner at the minimum value of t. After that we can interpolate them.
0995  
0996     // First try to find t_1 and t_4
0997 
0998     if(SigPar[0][x_1][y_1][9] != -10001){ // l_1 is t_min for the first corner - this is always the bottom left corner
0999       l_1 = SigPar[0][x_1][y_1][9];
1000     }
1001     else if (SigPar[0][x_1][y_1][10] != -10001){
1002       l_1 =  SigPar[0][x_1][y_1][10];
1003     }       
1004     else if ( SigPar[0][x_1][y_1][11] != -10001){
1005       l_1 =  SigPar[0][x_1][y_1][11];
1006     }
1007     else {
1008       return -100;
1009     } 
1010     //...................................................................................
1011     if(SigPar[0][x_2][y_2][9] != -10001){  // l_4 is t_min for the fourth corner - this is always the top right corner
1012       l_4 = SigPar[0][x_2][y_2][9];
1013     }
1014     else if (SigPar[0][x_2][y_2][10] != -10001){
1015       l_4 =SigPar[0][x_2][y_2][10];
1016     }
1017     else if (SigPar[0][x_2][y_2][11] != -10001){
1018       l_4 = SigPar[0][x_2][y_2][11];
1019     }
1020     else {
1021       return -100;
1022     } 
1023     //Calculating the sigL11 at bottom left corner of the square
1024     if (l_1>=SigPar[0][x_1][y_1][9] && l_1<SigPar[0][x_1][y_1][10]){
1025       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
1026         TF1* parasigL= new TF1("parasigL","expo");
1027         parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
1028         parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
1029         sigL11=parasigL->Eval(l_1); 
1030      
1031         if (SigPar[0][x_1][y_1][2] == 0 && SigPar[0][x_1][y_1][3] == 0){
1032           sigL11=0;
1033         }
1034             
1035         delete parasigL;
1036         parasigL = NULL;
1037       }
1038       
1039       else{
1040         TF1* parasigL= new TF1("parasigL","pol2");
1041         parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
1042         parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
1043         parasigL->FixParameter(2, SigPar[0][x_1][y_1][4]);
1044         sigL11=parasigL->Eval(l_1);
1045             
1046             delete parasigL;
1047             parasigL = NULL;
1048       }
1049     }
1050      
1051     else if (l_1>=SigPar[0][x_1][y_1][10] && l_1<SigPar[0][x_1][y_1][11]){
1052       TF1* parasigL= new TF1("parasigL","expo");
1053       parasigL->FixParameter(0, SigPar[0][x_1][y_1][5]); 
1054       parasigL->FixParameter(1, SigPar[0][x_1][y_1][6]);
1055       sigL11=parasigL->Eval(l_1); 
1056       
1057       if (SigPar[0][x_1][y_1][5] == 0 && SigPar[0][x_1][y_1][6] == 0){
1058         sigL11=0;
1059       }
1060       
1061       delete parasigL;
1062       parasigL = NULL;
1063     }
1064      
1065     else if (l_1>=SigPar[0][x_1][y_1][11] && t<2.0){
1066       TF1* parasigL= new TF1("parasigT","expo");
1067       parasigL->FixParameter(0, SigPar[0][x_1][y_1][7]); 
1068       parasigL->FixParameter(1, SigPar[0][x_1][y_1][8]);
1069       sigL11=parasigL->Eval(l_1); 
1070      
1071       if (SigPar[0][x_1][y_1][7] == 0 && SigPar[0][x_1][y_1][8] == 0){
1072         sigL11=0;
1073       }
1074       
1075       delete parasigL;
1076       parasigL = NULL;
1077     }
1078      
1079     else {
1080       sigL11=0;
1081     }   
1082     
1083     //Calculating the sigL14 at bottom left corner of the square 
1084     if (l_4>=SigPar[0][x_2][y_2][9] && l_4<SigPar[0][x_2][y_2][10]){
1085       if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
1086         TF1* parasigL= new TF1("parasigL","expo");
1087         parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
1088         parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
1089         sigL14=parasigL->Eval(l_4); 
1090      
1091         if (SigPar[0][x_2][y_2][2] == 0 && SigPar[0][x_2][y_2][3] == 0){
1092           sigL14=0;
1093         }
1094             
1095             delete parasigL;
1096             parasigL = NULL;
1097       }
1098       
1099       else{
1100         TF1* parasigL= new TF1("parasigL","pol2");
1101         parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
1102         parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
1103         parasigL->FixParameter(2, SigPar[0][x_2][y_2][4]);
1104         sigL14=parasigL->Eval(l_4);
1105             
1106             delete parasigL;
1107             parasigL = NULL;
1108       }
1109          
1110     }
1111      
1112     else if (l_4>=SigPar[0][x_2][y_2][10] && l_4<SigPar[0][x_2][y_2][11]){
1113       TF1* parasigL= new TF1("parasigL","expo");
1114       parasigL->FixParameter(0, SigPar[0][x_2][y_2][5]); 
1115       parasigL->FixParameter(1, SigPar[0][x_2][y_2][6]);
1116       sigL14=parasigL->Eval(l_4); 
1117       
1118       if (SigPar[0][x_2][y_2][5] == 0 && SigPar[0][x_2][y_2][6] == 0){
1119         sigL14=0;
1120       }
1121           
1122           delete parasigL;
1123           parasigL = NULL;
1124     }
1125      
1126     else if (l_4>=SigPar[0][x_2][y_2][11] && t<2.0){
1127       TF1* parasigL= new TF1("parasigT","expo");
1128       parasigL->FixParameter(0, SigPar[0][x_2][y_2][7]); 
1129       parasigL->FixParameter(1, SigPar[0][x_2][y_2][8]);
1130       sigL14=parasigL->Eval(l_4); 
1131      
1132       if (SigPar[0][x_2][y_2][7] == 0 && SigPar[0][x_2][y_2][8] == 0){
1133         sigL14=0;
1134       }
1135       
1136       delete parasigL;
1137       parasigL = NULL;
1138     }
1139      
1140     else {
1141       sigL14=0;
1142     }
1143 
1144     // Taking the log of claculated sigL values
1145     lsigL1 = TMath::Log(sigL11); //log value of sigL11.
1146     lsigL3 = TMath::Log(sigL3); //log value of sigL3.
1147     lsigL4 = TMath::Log(sigL14); //log value of sigL14.
1148 
1149     // Calculated slopes of different lines  
1150     stb = lsigL4-lsigL3; //->interpolation from the third corner
1151     stl = -(lsigL1-lsigL3);
1152     // Applying taylor's series formula without averaging the slopes
1153         fsigLLa = lsigL3 + (q2-q2_1)*stb + (w-w_2)*stl; //->interpolation from the third corner
1154      
1155     // Find the anti-log of the taylor's series formula value 
1156         fsigLa = exp(fsigLLa);
1157       }
1158     //...................................................................................
1159     //...................................................................................
1160 
1161     else if (sigL1 == 0 && sigL2 == 0){  // if we loose the 1st and the 2nd corner simultaneously
1162       // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) and the fourth corner (i.e. top right)will always be there and for other one corner, find the value of the cross-section at the first corner at the minimum value of t. After that we can interpolate them.
1163 
1164       // First try to find t_1
1165 
1166       if(SigPar[0][x_1][y_1][9] != -10001){ // l_1 is t_min for the first corner - this is always the bottom left corner
1167     l_1 = SigPar[0][x_1][y_1][9];
1168       }
1169       else if (SigPar[0][x_1][y_1][10] != -10001){
1170     l_1 =  SigPar[0][x_1][y_1][10];
1171       }       
1172       else if ( SigPar[0][x_1][y_1][11] != -10001){
1173     l_1 =  SigPar[0][x_1][y_1][11];
1174       }
1175       else {
1176     return -100;
1177       } 
1178       //...................................................................................
1179       //Calculating the sigL11 at bottom left corner of the square
1180       if (l_1>=SigPar[0][x_1][y_1][9] && l_1<SigPar[0][x_1][y_1][10]){
1181     if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
1182       TF1* parasigL= new TF1("parasigL","expo");
1183       parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
1184       parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
1185       sigL11=parasigL->Eval(l_1); 
1186      
1187       if (SigPar[0][x_1][y_1][2] == 0 && SigPar[0][x_1][y_1][3] == 0){
1188         sigL11=0;
1189       }
1190           
1191       delete parasigL;
1192       parasigL = NULL;
1193     }
1194       
1195     else{
1196       TF1* parasigL= new TF1("parasigL","pol2");
1197       parasigL->FixParameter(0, SigPar[0][x_1][y_1][2]); 
1198       parasigL->FixParameter(1, SigPar[0][x_1][y_1][3]);
1199       parasigL->FixParameter(2, SigPar[0][x_1][y_1][4]);
1200       sigL11=parasigL->Eval(l_1);
1201           
1202           delete parasigL;
1203           parasigL = NULL;
1204     }
1205       }
1206      
1207       else if (l_1>=SigPar[0][x_1][y_1][10] && l_1<SigPar[0][x_1][y_1][11]){
1208     TF1* parasigL= new TF1("parasigL","expo");
1209     parasigL->FixParameter(0, SigPar[0][x_1][y_1][5]); 
1210     parasigL->FixParameter(1, SigPar[0][x_1][y_1][6]);
1211     sigL11=parasigL->Eval(l_1);
1212     if (SigPar[0][x_1][y_1][5] == 0 && SigPar[0][x_1][y_1][6] == 0){
1213       sigL11=0;
1214     }
1215     
1216     delete parasigL;
1217     parasigL = NULL;
1218       }
1219      
1220       else if (l_1>=SigPar[0][x_1][y_1][11] && t<2.0){
1221     TF1* parasigL= new TF1("parasigT","expo");
1222     parasigL->FixParameter(0, SigPar[0][x_1][y_1][7]); 
1223     parasigL->FixParameter(1, SigPar[0][x_1][y_1][8]);
1224     sigL11=parasigL->Eval(l_1);  
1225     if (SigPar[0][x_1][y_1][7] == 0 && SigPar[0][x_1][y_1][8] == 0){
1226       sigL11=0;
1227     }
1228         
1229     delete parasigL;
1230     parasigL = NULL;
1231       }
1232      
1233       else {
1234     sigL11=0;
1235       }
1236      
1237       // Taking the log of claculated sigL values
1238       lsigL1 = TMath::Log(sigL11); //log value of sigL11.
1239       lsigL3 = TMath::Log(sigL3); //log value of sigL3.
1240       lsigL4 = TMath::Log(sigL4); //log value of sigL4.
1241       // Calculated slopes of different lines 
1242       stb = lsigL4-lsigL3; //->interpolation from the third corner
1243       stl = -(lsigL1-lsigL3);
1244         
1245       // Applying taylor's series formula without averaging the slopes
1246       fsigLLa = lsigL3 + (q2-q2_1)*stb + (w-w_2)*stl; //->interpolation from the third corner
1247       
1248       // Find the anti-log of the taylor's series formula value        
1249       fsigLa = exp(fsigLLa);
1250     }          
1251 
1252     //..............................................................................
1253     //...................................................................................
1254 
1255     else if (sigL4 == 0 && sigL2 == 0){  // if we loose the 4th and the 2nd corner simultaneously
1256       // In this case, we will need atleat three corners to find the cross-section. The third corner (i.e. top left) and the first corner (i.e. top right) will always be there and for other one corner, find the value of the cross-section at the fourth corner at the minimum value of t. After that we can interpolate them.
1257 
1258       // First try to find l_4
1259       if(SigPar[0][x_2][y_2][9] != -10001){  // l_4 is t_min for the fourth corner - this is always the top right corner
1260     l_4 = SigPar[0][x_2][y_2][9];
1261       }
1262       else if (SigPar[0][x_2][y_2][10] != -10001){
1263     l_4 =SigPar[0][x_2][y_2][10];
1264       }
1265       else if (SigPar[0][x_2][y_2][11] != -10001){
1266     l_4 = SigPar[0][x_2][y_2][11];
1267       }
1268       else {
1269     return -100;
1270       } 
1271 
1272       //Calculating the sigL14 at bottom left corner of the square 
1273       if (l_4>=SigPar[0][x_2][y_2][9] && l_4<SigPar[0][x_2][y_2][10]){
1274     if(w_1 ==2 || w_2 ==2 || w_1 ==3 ||w_2 ==3){
1275       TF1* parasigL= new TF1("parasigL","expo");
1276       parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
1277       parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
1278       sigL14=parasigL->Eval(l_4); 
1279      
1280       if (SigPar[0][x_2][y_2][2] == 0 && SigPar[0][x_2][y_2][3] == 0){
1281         sigL14=0;
1282       }
1283       
1284       delete parasigL;
1285       parasigL = NULL;
1286     }
1287       
1288     else{
1289       TF1* parasigL= new TF1("parasigL","pol2");
1290       parasigL->FixParameter(0, SigPar[0][x_2][y_2][2]); 
1291       parasigL->FixParameter(1, SigPar[0][x_2][y_2][3]);
1292       parasigL->FixParameter(2, SigPar[0][x_2][y_2][4]);
1293       sigL14=parasigL->Eval(l_4);
1294       
1295       delete parasigL;
1296       parasigL = NULL;
1297     }
1298          
1299       }
1300      
1301       else if (l_4>=SigPar[0][x_2][y_2][10] && l_4<SigPar[0][x_2][y_2][11]){
1302     TF1* parasigL= new TF1("parasigL","expo");
1303     parasigL->FixParameter(0, SigPar[0][x_2][y_2][5]); 
1304     parasigL->FixParameter(1, SigPar[0][x_2][y_2][6]);
1305     sigL14=parasigL->Eval(l_4); 
1306       
1307     if (SigPar[0][x_2][y_2][5] == 0 && SigPar[0][x_2][y_2][6] == 0){
1308       sigL14=0;
1309     }
1310     
1311     delete parasigL;
1312     parasigL = NULL;
1313       }
1314      
1315       else if (l_4>=SigPar[0][x_2][y_2][11] && t<2.0){
1316     TF1* parasigL= new TF1("parasigT","expo");
1317     parasigL->FixParameter(0, SigPar[0][x_2][y_2][7]); 
1318     parasigL->FixParameter(1, SigPar[0][x_2][y_2][8]);
1319     sigL14=parasigL->Eval(l_4); 
1320      
1321     if (SigPar[0][x_2][y_2][7] == 0 && SigPar[0][x_2][y_2][8] == 0){
1322       sigL14=0;
1323     }
1324     
1325     delete parasigL;
1326     parasigL = NULL;
1327       }
1328      
1329       else {
1330     sigL14=0;
1331       }
1332       // Taking the log of claculated sigL values
1333       lsigL1 = TMath::Log(sigL1); //log value of sigL11.
1334       lsigL3 = TMath::Log(sigL3); //log value of sigL3.
1335       lsigL4 = TMath::Log(sigL14); //log value of sigL4.
1336       // Calculated slopes of different lines 
1337       stb = lsigL4-lsigL3; //->interpolation from the third corner
1338       stl = -(lsigL1-lsigL3);
1339         
1340       // Applying taylor's series formula without averaging the slopes
1341       fsigLLa = lsigL3 + (q2-q2_1)*stb + (w-w_2)*stl; //->interpolation from the third corner
1342       
1343       // Find the anti-log of the taylor's series formula value        
1344       fsigLa = exp(fsigLLa);
1345     }        
1346 
1347     //..............................................................................
1348     //...................................................................................
1349 
1350     else if (sigL2 == 0) { // if we loose 2nd corner, first we will always loose this corner as this correspond to highest -t value (interpolate from 3rd corner)
1351       // In this case, we will need atleat three corners to find the cross-section. And even after loosing second corner, we still have three corners to interpolate.      
1352       // Taking the log of claculated sigT values         
1353       lsigL1 = TMath::Log(sigL1); //log value of sigL1.
1354       lsigL3 = TMath::Log(sigL3); //log value of sigL3.
1355       lsigL4 = TMath::Log(sigL4); //log value of sigL4.
1356 
1357       // Calculated slopes of different lines
1358       stb = lsigL4-lsigL3; //->interpolation from the third corner
1359       stl = -(lsigL1-lsigL3);
1360         
1361       // Applying taylor's series formula without averaging the slopes
1362       fsigLLa = lsigL3 + (q2-q2_1)*stb + (w-w_2)*stl; //->interpolation from the third corner
1363    
1364       // Find the anti-log of the taylor's series formula value         
1365       fsigLa = exp(fsigLLa);
1366     }        
1367    
1368     //...................................................................................
1369     //...................................................................................         
1370   } // end of if statement over t
1371   //....................................................................................................................................................................
1372   else{
1373     //cerr<<" Invalid t-value "<<endl;
1374     return -100;
1375   } 
1376   //....................................................................................................................................................................
1377   //.................................................................................................................................................................... 
1378 
1379   //sig_total = 5222;
1380   sig_total = fsigTa +(feps*fsigLa); 
1381 
1382   return sig_total;
1383 
1384 }